package com.example.demo.infra.repository.impl;

import com.example.demo.app.repository.StudentRepository;
import com.example.demo.domain.entity.Student;
import com.example.demo.domain.vo.StudentCourseGradesVO;
import com.example.demo.infra.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class StudentRepositoryImpl implements StudentRepository {
    @Autowired
    private StudentMapper studentMapper;
    @Override
    public Student queryStudentById(Integer id) {
        return studentMapper.selectStudentById(id);
    }

    @Override
    public List<Student> queryStudentList() {
        return studentMapper.selectStudentList();
    }

    @Override
    public Integer addStudent(Student student) {
        return studentMapper.insertStudent(student);
    }

    @Override
    public Integer saveStudent(Student student) {
        return studentMapper.updateStudent(student);
    }

    @Override
    public Integer deleteStudentById(Integer id) {
        return studentMapper.deleteStudentById(id);
    }

    @Override
    public List<StudentCourseGradesVO> queryStudentCourseGrade(String sname) {
        return studentMapper.selectStudentCourseGrade(sname);
    }
}
